﻿using System;
using System.Collections.Generic;
using System.Text;

namespace BEGDC.MIS.Office.Excel
{
    public class Element : IComparable
    {
        private string name;
        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
            }
        }

        private string type;
        public string Type
        {
            get
            {
                return type;
            }
            set
            {
                type = value;
            }
        }

        private string position;
        public string Position
        {
            get
            {
                return position;
            }
            set
            {
                position = value;
            }
        }

        private bool is_key;
        public bool IsKey
        {
            get
            {
                return is_key;
            }
            set
            {
                is_key = value;
            }
        }

        private bool is_fixed;
        public bool IsFixed
        {
            get
            {
                return is_fixed;
            }
            set
            {
                is_fixed = value;
            }
        }

        private bool is_convert;
        public bool IsConvert
        {
            get
            {
                return is_convert;
            }
            set
            {
                is_convert = value;
            }
        }

        private string fixed_value;
        public string FixedValue
        {
            get
            {
                return fixed_value;
            }
            set
            {
                fixed_value = value;
            }
        }

        private string validation;
        public string Validation
        {
            get
            {
                return validation;
            }
            set
            {
                validation = value;
            }
        }

        private string rule;
        public string Rule
        {
            get
            {
                return rule;
            }
            set
            {
                rule = value;
            }
        }

        private string sample = string.Empty;
        public string Sample
        {
            get
            {
                return sample;
            }
            set
            {
                sample = value;
            }
        }


        public int CompareTo(object obj)
        {
            return this.name.CompareTo(((Element)obj).name);
        }

        public override bool Equals(Object obj)
        {
            if (obj.GetType() == typeof(string))
            {
                return this.name.Equals(obj);
            }
            if (obj.GetType() == typeof(Element))
            {
                return this.name.Equals(((Element)obj).name);
            }
            return false;
        }

        public override int GetHashCode()
        {
            return this.name.GetHashCode();
        }
    }
}
